<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resource/bootstrap4/css/bootstrap.css">
    <script src="${pageContext.request.contextPath}/resource/js/jquery-3.2.1.js"></script>
    <script src="${pageContext.request.contextPath}/resource/bootstrap-treeview/js/bootstrap-treeview.js"></script>
    <script src="${pageContext.request.contextPath}/resource/bootstrap4/js/bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/resource/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
    <form>
        名称：<input name="name">
    </form>
    <button type="button" onclick="sub()">提交</button>
    <script>
        function sub() {
            $.post("${pageContext.request.contextPath}/desire/insert",$("form").serialize(),function (result) {
                if (result > 0){
                    alert("添加成功!");
                    location='${pageContext.request.contextPath}/desire/list'
                }else{
                    alert("请勿重复提交");
                }
            })
        }
    </script>
</body>
</html>
